<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <title>科转</title>
    <link href="layuiv29/css/layui.css" rel="stylesheet">
    <script src="layuiv29/layui.js"></script>
    <style>

        .login-header {
            color: rgba(0, 0, 0, .85) !important;
            padding: 5% 0;
            text-align: center;
        }
        .layui-text em, .layui-word-aux {
            color: #ef0909 !important;
            padding: 0 5px !important;
        }
        .layui-input-block {
            margin-left: 0;
            min-height: 46px;
        }
        @media screen and (min-width: 800px) {
            .layui-form-label{
                width: 86px !important;
            }
            .smallbox{
                font-size: 4vh !important;
                margin: 15px !important;
            }
        }
        .content_box{
            max-width: 760px;
            padding: 0px;
        }
        .imgbanner{
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .imgbanner img{
            width: 100%;
        }
        .entrance{
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
        }
        .smallbox{
            width: 45%;
            height: auto;
            background-color: #8dc63f;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-size: 2vh;
            color: #fff;
            margin: 10px;
            padding-top: 2%;
            padding-bottom: 2%;
        }
        .smallbox img{
            width: 30%;
        }
        .smallbox:nth-child(2){
            background-color: #3576FD;
        }
        .smallbox:nth-child(3){
            background-color: #39b54a;
        }
        .smallbox:nth-child(4){
            background-color: #1cbbb4;
        }
    </style>
</head>
<body>
<div class="body">
    <div class="layui-fluid content_box">
        <div class="imgbanner">
<!--            <img src="./assets/images/sxdx.png" alt="">-->
        </div>
        <div id="ID-tree-demo-showCheckbox"></div>
        <input type="radio" name="treeRadio" title="树选择器">
        <div id="tree" class="layui-tree-box"></div>
        <div class="entrance">
            <div class="smallbox" onclick="goaddapply()">
                <img src="./assets/images/icon_ck.png" alt="">
                <p>我要转让</p>
            </div>
            <div class="smallbox" onclick="bindHrefPage()">
                <img src="./assets/images/kc_see.png" alt="">
                <p>转让记录</p>
            </div>
            <div class="smallbox" onclick="bindHrefPage()">
                <img src="./assets/images/icon_pdjl.png" alt="">
                <p>专利许可</p>
            </div>
            <div class="smallbox" onclick="bindHrefPage()">
                <img src="./assets/images/icon_pd.png" alt="">
                <p>专利盘活</p>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="assets/js/config.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script src="https://wwcdn.weixin.qq.com/node/open/js/wecom-jssdk-1.3.1.js"></script>
<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js" referrerpolicy="origin"></script>

<script>
    layui.use(["layer", "form","upload","tree"], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var upload = layui.upload;
        var router = layui.router();
        var tree = layui.tree;


        var data =  [
            {
                "id": "1",
                "title": "山西大学",
                "dept_type": "1",
                "disabled": true,
                "children": [
                    {
                        "id": "2",
                        "title": "坞城路大学分校",
                        "dept_type": "1",
                        "disabled": true,
                        "children": [
                            {
                                "id": "2-2",
                                "title": "贾伟",
                                "workno": "111522",
                                "phone_no": "1506829908",
                                "qywx_user_id": "ceshi1",
                                "dept_id": "2",
                                "dept_type": 3
                            },
                            {
                                "id": "3-2",
                                "title": "李博",
                                "workno": "115749",
                                "phone_no": "1506830346",
                                "qywx_user_id": "ceshi2",
                                "dept_id": "2",
                                "dept_type": 3
                            },
                            {
                                "id": "4-2",
                                "title": "李伟强",
                                "workno": "111057",
                                "phone_no": "1507015260",
                                "qywx_user_id": "ceshi3",
                                "dept_id": "2",
                                "dept_type": 3
                            },
                            {
                                "id": "11-2",
                                "title": "吉晓辉",
                                "workno": "15167",
                                "phone_no": "1511235208",
                                "qywx_user_id": "ceshi10",
                                "dept_id": "2",
                                "dept_type": 3
                            },
                            {
                                "id": "15-2",
                                "title": "孟瑜",
                                "workno": "111548",
                                "phone_no": "18611631935",
                                "qywx_user_id": "ceshi14",
                                "dept_id": "2",
                                "dept_type": 3
                            },
                            {
                                "id": "3",
                                "title": "校长办公室",
                                "dept_type": "2",
                                "disabled": true,
                                "children": [
                                    {
                                        "id": "5-3",
                                        "title": "张立博",
                                        "workno": "111555",
                                        "phone_no": "1507028479",
                                        "qywx_user_id": "ceshi4",
                                        "dept_id": "3",
                                        "dept_type": 3
                                    },
                                    {
                                        "id": "8-3",
                                        "title": "孙益明",
                                        "workno": "115766",
                                        "phone_no": "1510192862",
                                        "qywx_user_id": "ceshi7",
                                        "dept_id": "3",
                                        "dept_type": 3
                                    },
                                    {
                                        "id": "12-3",
                                        "title": "丁军平",
                                        "workno": "14607",
                                        "phone_no": "1511250625",
                                        "qywx_user_id": "ceshi11",
                                        "dept_id": "3",
                                        "dept_type": 3
                                    },
                                    {
                                        "id": "16-3",
                                        "title": "赵宁",
                                        "workno": "112937",
                                        "phone_no": "18611631935",
                                        "qywx_user_id": "ceshi15",
                                        "dept_id": "3",
                                        "dept_type": 3
                                    }
                                ]
                            },
                            {
                                "id": "4",
                                "title": "教师部",
                                "dept_type": "2",
                                "disabled": true,
                                "children": [
                                    {
                                        "id": "6-4",
                                        "title": "陈朝阳",
                                        "workno": "113088",
                                        "phone_no": "1508030750",
                                        "qywx_user_id": "ceshi5",
                                        "dept_id": "4",
                                        "dept_type": 3
                                    },
                                    {
                                        "id": "7-4",
                                        "title": "杨博",
                                        "workno": "115757",
                                        "phone_no": "1509093254",
                                        "qywx_user_id": "ceshi6",
                                        "dept_id": "4",
                                        "dept_type": 3
                                    },
                                    {
                                        "id": "9-4",
                                        "title": "张志杰",
                                        "workno": "111111",
                                        "phone_no": "1510455680",
                                        "qywx_user_id": "ceshi8",
                                        "dept_id": "4",
                                        "dept_type": 3
                                    },
                                    {
                                        "id": "13-4",
                                        "title": "梁武",
                                        "workno": "112614",
                                        "phone_no": "1511255111",
                                        "qywx_user_id": "ceshi12",
                                        "dept_id": "4",
                                        "dept_type": 3
                                    },
                                    {
                                        "id": "17-4",
                                        "title": "陈纪安",
                                        "workno": "15179",
                                        "phone_no": "18611631935",
                                        "qywx_user_id": "ceshi16",
                                        "dept_id": "4",
                                        "dept_type": 3
                                    }
                                ]
                            },
                            {
                                "id": "5",
                                "title": "技术开发与产业管理处",
                                "dept_type": "2",
                                "disabled": true,
                                "children": [
                                    {
                                        "id": "10-5",
                                        "title": "闫美廷",
                                        "workno": "111111",
                                        "phone_no": "1510456139",
                                        "qywx_user_id": "ceshi9",
                                        "dept_id": "5",
                                        "dept_type": 3
                                    },
                                    {
                                        "id": "14-5",
                                        "title": "贾建平",
                                        "workno": "111658",
                                        "phone_no": "1511431492",
                                        "qywx_user_id": "ceshi13",
                                        "dept_id": "5",
                                        "dept_type": 3
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ];

        tree.render({
            elem: '#tree' // 绑定元素
            ,data: data // 树组件的数据
            ,radio: true // 开启单选模式
            ,onlyIconControl: true // 仅有图标控制打开关闭
            ,id: 'tree' // 设定一个id，用于后续的事件监听
        });

        // 定义事件过滤器
        form.on('radio(tree)', function(data){
            console.log(data.value); // 被选中节点的id
            // 在这里可以执行单选后的逻辑
        });

        // 渲染
        tree.render({
            elem: '#ID-tree-demo-showCheckbox',
            data: data,
            showCheckbox: true,
            checkType: "radio",
            click: function(obj){
                var data = obj.data;  //获取当前点击的节点数据
                layer.msg('状态：'+ obj.title + '<br>节点数据：' + JSON.stringify(data));
            },
            oncheck: function(obj) {
                var data = obj.data; //得到当前点击的节点数据
                var state = obj.checked;
            }

        });
        tree.on('check()', function(obj) {
            // 获取勾选状态
            var isChecked = obj.checked;
            // 获取当前节点数据
            var data = obj.data;

            // 根据勾选状态进行处理
            if (isChecked) {
                // 处理勾选操作
                console.log('节点被勾选：', data);
            } else {
                // 处理取消勾选操作
                console.log('节点被取消勾选：', data);
            }
        });
    });
        /*let userMsg = localStorage.getItem("userMsg");
        if (userMsg==null || !userMsg){  //如果没有获取到用户信息， 进行授权获取
            var code = getUrlParam('code');
            var hreftemp = window.location.href;

            console.log(code,"============获取用户信息完成====================");
            if(code==null || !code ){ //如果没有code进行重定向
                if(hreftemp.indexOf('uhref=')>0){
                    return;
                }else{
                    //跳转获取code
                    $.post("https://desheng.hot68.cn/sxdx/api/public/index.php/app/Wxprogramehtml/getOAuthRedirectUrl", {'url':hreftemp}, function(res) {
                        window.location.href = res.obj;
                    }, "json");
                }
                return;
            }else{ //通过凑得获取登录信息
                $.post("https://desheng.hot68.cn/sxdx/api/public/index.php/app/Wxprogramehtml/getUserByCode", {'code':code}, function(res) {
                    localStorage.setItem("userMsg",JSON.stringify(res.obj));
                    location.reload();
                }, "json");
                return;
            }
        }

        userMsg = localStorage.getItem("userMsg");
        //准备注册授权
        var userMsg2 = JSON.parse(userMsg)
        console.log(userMsg2,'----------------------------1111----------')
        //获取用户信息， 通过code
        $.post("https://desheng.hot68.cn/sxdx/api/public/index.php/app/Wxprogramehtml/getTwoTicket",
            {'corpid':userMsg2['CorpId'],'urlAdress':window.location.href}, function(res) {
                let config = res.obj.config;
                let agentConfig =  res.obj.agentConfig;

                console.log(res,'----------------------------2222----------')
                ww.register({
                    corpId: config.corpid,
                    agentId:config.agentid,
                    jsApiList:["selectEnterpriseContact","selectExternalContact","openUserProfile","selectPrivilegedContact"],
                    getConfigSignature() {
                        return ww.getSignature(config.ticket)
                    },
                    getAgentConfigSignature(){
                        return ww.getSignature(agentConfig.ticket)
                    },
                    onAgentConfigFail(){
                        console.log("签名失败");
                    },
                    onAgentConfigSuccess: function (res) {
                        regSunccFun();
                    },
                    error: function (res) {
                        //请求异常回调
                        console.log(res)
                        return false;
                    }
                })
            }, "json");*/


        /*function regSunccFun(){
            ww.initOpenData({
                success: function (res) {
                    console.log(WWOpenData, "初始化完成了哈哈哈哈")
                    /!*const openid = '123MuTouRen'
                    document.getElementById('userData').setAttribute('openid', openid);
                    WWOpenData.bind(document.querySelector('ww-open-data'));

                    console.log(WWOpenData, "初始化完成了哈哈哈哈")*!/
                },
                error: function (res) {
                    //请求异常回调
                    console.log("======================2")
                    console.log(res)
                    return false;
                }
            });
        }

        function viewPort() {
            const meta = document.querySelector('meta[name="viewport"]');
            const scale = window.screen.width / 375 < 1 ? 1 : window.screen.width / 375;
            meta.content = `width=device-width,initial-scale=${scale}`
        }
        viewPort()
        window.onresize = viewPort;
    });*/


    function goaddapply(params) {
        window.location.href = `addapplyknow.html`;
    }
    function bindHrefPage(params) {
        window.location.href = `turnrecord.html`;
    }
</script>
</body>
</html>